// Copyright 2008 Senary
// See credits.txt for details.

// This file is part of Omega VII.

// Omega VII is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Omega VII is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Omega VII.  If not, see <http://www.gnu.org/licenses/>.

#include "ImagePanel.h"
#include "MediaManager.h"

using namespace std;

ImagePanel::ImagePanel(pair<int, int> position, int layer, string imageName)
	: Panel(position, layer)
{
	_image = MediaManager::getInstance()->getImage(imageName);
}

ImagePanel::~ImagePanel(void)
{
}

void ImagePanel::createPanel()
{
	Panel::createPanel();
	_pPanel->bmap = _image;
	_pPanel->size_x = _VAR(_image->width);
	_pPanel->size_y = _VAR(_image->height);
}

// change the bitmap
void ImagePanel::setImage(std::string imageName)
{
	if(_pPanel==0) return;

	_image = MediaManager::getInstance()->getImage(imageName);
	_pPanel->bmap = _image;
	_pPanel->size_x = _VAR(_image->width);
	_pPanel->size_y = _VAR(_image->height);
}
